The Dynamic Host Configuration Protocol (DHCP) provides Internet hosts with configuration parameters. DHCP is an extension of BOOTP. BOOTP enables diskless clients to start up and automatically configure TCP/IP. DHCP consists of two components: a protocol for delivering host-specific configuration parameters from a DHCP server to a host and a mechanism for allocation of network addresses to hosts. (Compliant with IETF RFC1531.)
Using DHCP to automatically configure IP addressing information means users no longer need to acquire IP addressing information from an administrator to configure TCP/IP. The DHCP server supplies all the necessary configuration information to all DHCP clients. Therefore, the most difficult-to-trace network problems are eliminated by using DHCP.
BOOTP Short for Bootstrap Protocol, an Internet protocol that enables a diskless workstation to discover its own IP address, the IP address of a BOOTP server on the network, and a file to be loaded into memory to boot the machine. This enables the workstation to boot without requiring a hard or floppy disk drive. The protocol is defined by RFC 951.
Each time a DHCP client starts, it requests IP addressing information from a DHCP server, including IP address, subnet mask, and other values like a default gateway address, DNS, NetBIOS name server address.
When a DHCP server receives a request from the client, it selects IP addressing information from a pool of addresses in it database and offers it to the DHCP client.
If the client accepts the offer, the IP addressing information is leased to the client for a specified period of time. If there are no available IP addressing information in pool to lease to a client, the client cannot initialize TCP/IP.
DHCP provides an alternative to manually assigning IP addresses to computers. DHCP automatically assigns, or leases, IP addresses to hosts from a centrally managed pool, thus keeps the administrator from having to assign all the IP addresses for each individual hosts/ node. Windows NT fully supports this standard and NT hosts can be configured to act as DHCP servers and clients.
Very few hosts require fixed IP addresses, those that do are usually your routers and DNS servers because these devices (addresses) are frequently used as configurations on hosts. Such as the default gateway or the DNS server.
Benefits to DHCP
DHCP lets administrators specify groups of IP addresses called scopes. These scopes lease IP addresses to the clients, depending on which subnet they're on. When the host is configured to obtain its IP address from a DHCP server, it is automatically assigned an address from a DHCP scope appropriate for its current subnet. DHCP provides less administrative hassles and new machines can be added to the network without assigning dedicated IP address. DHCP allows a small pool of addresses to serve a larger number of nodes, if all machines are not used at once.
DHCP is centrally managed, therefore administrators can manage many characteristics. Meaning, DHCP can be configured to send appropriate DNS and WINS server addresses and assign default gateway addresses to the clients configuration. It is simple to install and very practical.
Disadvantages to DHCP
The disadvantages to DHCP include the necessity of managing the address pool, the potential for conflicts between DHCP-assigned and manually-assigned addresses. DHCP requests are not passed through a router unless it has been specifically configured to forward them.
Very Brief summary of how DHCP works
In the first two phases, the client requests a lease from DHCP server, and a DHCP server offers an IP address to the client.
IP Lease Request
The first time a client initializes, it requests to lease an IP address by broadcasting a request to all DHCP servers, because client does not have an IP address or know the IP address of DHCP server, it uses 0.0.0.0 as the source address and 255.255.255.255 as destination address.
The request for a lease is sent to DHCPDISCOVER message (which contains the client's hardware address and computer name so DHCP servers know which client sent the request.
IP Lease is used in the following situations:
- TCP/IP is initialized for the first time as a DHCP client
- Client requests a specific IP address and is denied, possibly due to DHCP server dropped the lease
- Client previously leased an IP address, but released the lease and now requires a new lease.
IP Lease Offer
DHCP servers that received the request and have a valid configuration for client broadcast offer the following:
- Client's MAC address
- Offered IP Address
- Subnet Mask
- Length of lease
- IP address of the offering DHCP server (server's identifier)
Once again, a broadcast is used because the client doesn't have an IP address yet.
DHCP server reserves the IP address so that it will not be offered to another DHCP client. The DHCP client selects the IP address from the first offer it receives
If no DHCP servers are available at that time the client waits one second for an offer. If an offer is not received, client will not be able to initialize and it will broadcast the request three more times (at 9, 13, 16 second intervals). If an offer is still not received after four requests, the client will retry every five minutes.
In the last two phases, the client selects an offer and the DHCP server acknowledges the lease.
IP Lease Selection
After client receives an offer from at least one DHCP server, it broadcasts to ALL DHCP servers that it has made a selection by accepting an offer.
The broadcast is sent in a DHCPREQUEST message and includes the server's IP address of the server whose offer was accepted.
IP Lease Acknowledgment (Successful)
The DHCP server with the accepted offer broadcasts a successful acknowledgment to the client in the form of a DHCPACK, which contains a valid lease for an IP address and possibly other configuration information.
When client receives the DHCPACK, TCP/IP is completely initialized and is considered a bound DHCP client. Once bound, the client can use TCP/IP to communicate on the internetwork.
The client stores the IP address, subnet mask, and other IP addressing information locally in the registry under the following key:
HKEY_LOCAL_MACHINES\SYSTEM\CurrentControlSet\Services\adapter\Parameters\Tcpip
IP Lease Acknowledgment (Unsuccessful)
An unsuccessful acknowledgment (DHCPNACK) is broadcast if the client is trying to lease its previous IP address and the IP address is no longer available or if the client has been physically moved to a different subnet.
All DHCP clients attempt to renew their lease when 50% of the lease time has expired. To renew a lease, a client sends a DHCPREQUEST message directly to DHCP server from which it obtained the initial lease.
If this server is available, it renews the lease and sends the client a DHCPACK with the new lease time and any updated configuration parameters.
If this server is unavailable, the client receives a message indicating the lease was not renewed. The client can still use the address because 50% of the lease time is still available. Or when a client restarts it attempts